module common.item;

import std.string;

import mirshare, mirdefine;

import common.imagearray;
import share.protocol, share.types, share.utility;

import allegro5.allegro;

public struct GroundItem
{
    public int Serial;
    public int TileX;
    public int TileY;
    public ushort Looks;
    public string Name;
}
public alias GroundItem* PGroundItem;


public struct Item
{
    public int m_bAttr = 0;
    public int m_shCellNum = 0;
    public ClientItem m_stItemInfo = m_stItemInfo.init;


    public bool setItem(ClientItem stItemInfo, int shInventoryNum)
    {
        m_stItemInfo = stItemInfo;
        m_shCellNum = shInventoryNum;
        
        switch (m_stItemInfo.S.StdMode)
        {
            case 5, 6: // ¹«±â.
                m_bAttr = U_WEAPON;
                break;
            case 10, 11: // ¿Ê.
                m_bAttr = U_DRESS;
                break;
            case 15:
                m_bAttr = U_HELMET;
                break;
            case 19, 20, 21:
                m_bAttr = U_NECKLACE;
                break;
            case 22, 23:
                m_bAttr = U_RINGL;
                break;
            case 24, 26:
                m_bAttr = U_ARMRINGL;
                break;
            case 30: // ÃÊ, È¶ºÒ.
                m_bAttr = U_RIGHTHAND;
                break;
            case 25: // µ¶°¡·ç, ºÎÀû.
                m_bAttr = U_ARMRINGL;
                break;
            default:
                m_bAttr = -1;
                return false;
        }
        
        return true;
    }

    public bool drawItem(int nX, int nY, int bItemType = _ITEM_TYPE_INVENTORY)
    {
        ALLEGRO_BITMAP* bmp;
        ImageInfo imgi;  
        bool bDrawItem = false;
        float dx, dy;

        switch ( bItemType )
        {
            case _ITEM_TYPE_INVENTORY:
            {
                bmp = PlayScene.m_xImage[_IMAGE_ITEM_INVENTORY].GetCachedImageEx(m_stItemInfo.S.Looks, imgi);
                if ( bmp !is null )
                {
                    dx = cast(float)(nX + (_INVENTORY_CELL_WIDTH / 2) - (imgi.Width / 2));
                    dy = cast(float)(nY + (_INVENTORY_CELL_HEIGHT / 2) - (imgi.Height / 2));
                    bDrawItem = true;
                }
                break;
            }

            case _ITEM_TYPE_EQUIP:
            {
                bmp = PlayScene.m_xImage[_IMAGE_ITEM_EQUIP].GetCachedImageEx(m_stItemInfo.S.Looks, imgi);
                if ( bmp !is null )
                {
                    dx = cast(float)(nX + imgi.PosX);
                    dy = cast(float)(nY + imgi.PosY);
                    bDrawItem = true;
                }
                break;
            }

            default: break;
        }
        
        if ( bDrawItem )
        {
            al_draw_bitmap(bmp, dx, dy, 0);
            return true;
        }

        return false;
    }

    public void showItemStatus(int nX, int nY)
    {
        const ALLEGRO_COLOR name_color = al_map_rgba(250, 250, 0, 255);
        const ALLEGRO_COLOR maindesc_color = al_map_rgba(250, 250, 250, 255);
        const ALLEGRO_COLOR disable_color = al_map_rgba(250, 0, 0, 255);
        const int nLineGap = 14;
        
        string lines[3];
        string iname;
        IntPoint pt;
        bool bUseAble = true;

        string GetDuraStr(int dura, int maxdura)
        {
            return format("%s/%s", (dura/1000), (maxdura/1000));
        }

        /*string WriteAC(string fmt, T...)
        {
            string buffer;
            static if (T.length == 1)
            {
                buffer = format(fmt, T);
            }
            else static if (T.length == 2)
            {
                buffer = format(fmt, LoByte(T[0]), HiByte(T[1]));
            }
            return buffer;
        }*/


        
        if ( m_stItemInfo.S.Name.length == 0 )
            return;

        switch ( m_stItemInfo.S.StdMode )
        {
            // ³²ÀÚ¿Ê, ¿©ÀÚ¿Ê.
            case 10, 11:
            {
                bUseAble = false;
                
                // Ã¹Â°ÁÙ.
                iname = m_stItemInfo.S.Name.idup;
                iname = iname.stripRight;
                MyPen.drawText(nX, nY, name_color, iname);
                pt = MyPen.measureText(iname);

                lines[0] = format(" Weight.%s Dura.%s/%s", m_stItemInfo.S.Weight, m_stItemInfo.Dura/1000, m_stItemInfo.DuraMax/1000);
                MyPen.drawText(nX + pt.getX(), nY, maindesc_color, lines[0]);
                
                
                // µÑÂ°ÁÙ.
                if ( m_stItemInfo.S.AC > 0 )
                    lines[1] = lines[1] ~ format("AC%s-%s ", LoByte(m_stItemInfo.S.AC), HiByte(m_stItemInfo.S.AC));
                
                if ( m_stItemInfo.S.MAC > 0 )
                    lines[1] = lines[1] ~ format("AMC%s-%s ", LoByte(m_stItemInfo.S.MAC), HiByte(m_stItemInfo.S.MAC));
                
                if ( m_stItemInfo.S.DC > 0 )
                    lines[1] = lines[1] ~ format("DC%s-%s ", LoByte(m_stItemInfo.S.DC), HiByte(m_stItemInfo.S.DC));
                
                if ( m_stItemInfo.S.MC > 0 )
                    lines[1] = lines[1] ~ format("MC%s-%s ", LoByte(m_stItemInfo.S.MC), HiByte(m_stItemInfo.S.MC));
                
                if ( m_stItemInfo.S.SC > 0 )
                    lines[1] = lines[1] ~ format("SC%s-%s ", LoByte(m_stItemInfo.S.SC), HiByte(m_stItemInfo.S.SC));

                MyPen.drawText(nX, nY + nLineGap, maindesc_color, lines[1]);
                
                // ¼¼Â°ÁÙ.
                switch ( m_stItemInfo.S.Need )
                {
                    case 0:
                    {
                        if ( PlayScene.m_xMyHero.m_stAbility.Level >= m_stItemInfo.S.NeedLevel )
                            bUseAble = true;
                        lines[2] = format("Necessary level %s ", m_stItemInfo.S.NeedLevel);
                        break;
                    }
                    case 1:
                    {
                        if ( HiByte(PlayScene.m_xMyHero.m_stAbility.DC) >= m_stItemInfo.S.NeedLevel )
                            bUseAble = true;
                        lines[2] = format("Necessay DC %s ", m_stItemInfo.S.NeedLevel);
                        break;
                    }
                    case 2:
                    {
                        if ( HiByte(PlayScene.m_xMyHero.m_stAbility.MC) >= m_stItemInfo.S.NeedLevel )
                            bUseAble = true;
                        lines[2] = format("Necessary MC %s ", m_stItemInfo.S.NeedLevel);
                        break;
                    }
                    case 3:
                    {
                        if ( HiByte(PlayScene.m_xMyHero.m_stAbility.SC) >= m_stItemInfo.S.NeedLevel )
                            bUseAble = true;
                        lines[2] = format("Necessary SC %s ", m_stItemInfo.S.NeedLevel);
                        break;
                    }
                    default: break;
                }
                
                if ( bUseAble )
                    MyPen.drawText(nX, nY + nLineGap*2, maindesc_color, lines[2]);
                else
                    MyPen.drawText(nX, nY + nLineGap*2, disable_color, lines[2]);
                break;
            }

                // ¹«±â.
            case 5:
            case 6:
            {
                bUseAble = false;
                
                // Ã¹Â°ÁÙ.
                if ( (m_stItemInfo.S.Attribute & 0X01) != 0 )           
                {
                    /*if ( m_stItemInfo.S.Name[20] )
                        g_xMainWnd.StringPlus(Name, "(*)", &m_stItemInfo.S.Name[20], " ", &m_stItemInfo.S.Name[0], "");
                    else
                        strcpy(Name, m_stItemInfo.S.Name);*/
                    iname = "(*)" ~ m_stItemInfo.S.Name.idup;
                }
                else                                                                
                {
                    /*if ( m_stItemInfo.S.Name[20] )
                        g_xMainWnd.StringPlus(Name, &m_stItemInfo.S.Name[20], " ", &m_stItemInfo.S.Name[0], "");
                    else
                        strcpy(Name, m_stItemInfo.S.Name);*/
                    iname = m_stItemInfo.S.Name.idup;
                }
                iname = iname.stripRight;

                MyPen.drawText(nX, nY, name_color, iname);
                pt = MyPen.measureText(iname);
                
                lines[0] = format(" Weight.%s Dura.%s/%s", m_stItemInfo.S.Weight, m_stItemInfo.Dura/1000, m_stItemInfo.DuraMax/1000);
                MyPen.drawText(nX + pt.getX(), nY, maindesc_color, lines[0]);
                
                // µÑÂ°ÁÙ.
                if ( m_stItemInfo.S.DC > 0 )
                    lines[1] = lines[1] ~ format("DC%s-%s ", LoByte(m_stItemInfo.S.DC), HiByte(m_stItemInfo.S.DC));
                
                if ( m_stItemInfo.S.MC > 0 )
                    lines[1] = lines[1] ~ format("MC%s-%s ", LoByte(m_stItemInfo.S.MC), HiByte(m_stItemInfo.S.MC));
                
                if ( m_stItemInfo.S.SC > 0 )
                    lines[1] = lines[1] ~ format("SC%s-%s ", LoByte(m_stItemInfo.S.SC), HiByte(m_stItemInfo.S.SC));
                
                if ( m_stItemInfo.S.SpecialPower > 0 )
                    lines[1] = lines[1] ~ format("°­µµ%s ", m_stItemInfo.S.SpecialPower);

                MyPen.drawText(nX, nY + nLineGap, maindesc_color, lines[1]);
                
                // ¼¼Â°ÁÙ.
                if ( HiByte(m_stItemInfo.S.AC) > 0 )
                    lines[2] = lines[2] ~ format("Accuracy+%s ", HiByte(m_stItemInfo.S.AC));
                
                if ( HiByte(m_stItemInfo.S.MAC) > 0 )
                {
                    if ( HiByte(m_stItemInfo.S.MAC) > 10 )
                        lines[2] = lines[2] ~ format("A.Speed+%s ", HiByte(m_stItemInfo.S.MAC)-10);
                    else
                        lines[2] = lines[2] ~ format("A.Speed-%s ", HiByte(m_stItemInfo.S.MAC));
                }
                
                if ( LoByte(m_stItemInfo.S.AC) > 0 )
                    lines[2] = lines[2] ~ format("Luck+%s ", LoByte(m_stItemInfo.S.AC));
                
                if ( LoByte(m_stItemInfo.S.MAC) > 0 )
                    lines[2] = lines[2] ~ format("Curse+%s ", LoByte(m_stItemInfo.S.MAC));
                
                switch ( m_stItemInfo.S.Need )
                {
                    case 0:
                    {
                        if ( PlayScene.m_xMyHero.m_stAbility.Level >= m_stItemInfo.S.NeedLevel )
                            bUseAble = true;
                        lines[2] = format("Necessary level %s ", m_stItemInfo.S.NeedLevel);
                        break;
                    }
                    case 1:
                    {
                        if ( HiByte(PlayScene.m_xMyHero.m_stAbility.DC) >= m_stItemInfo.S.NeedLevel )
                            bUseAble = true;
                        lines[2] = format("Necessay DC %s ", m_stItemInfo.S.NeedLevel);
                        break;
                    }
                    case 2:
                    {
                        if ( HiByte(PlayScene.m_xMyHero.m_stAbility.MC) >= m_stItemInfo.S.NeedLevel )
                            bUseAble = true;
                        lines[2] = format("Necessary MC %s ", m_stItemInfo.S.NeedLevel);
                        break;
                    }
                    case 3:
                    {
                        if ( HiByte(PlayScene.m_xMyHero.m_stAbility.SC) >= m_stItemInfo.S.NeedLevel )
                            bUseAble = true;
                        lines[2] = format("Necessary SC %s ", m_stItemInfo.S.NeedLevel);
                        break;
                    }
                    default: break;
                }

                if ( bUseAble )
                    MyPen.drawText(nX, nY + nLineGap*2, maindesc_color, lines[2]);
                else
                    MyPen.drawText(nX, nY + nLineGap*2, disable_color, lines[2]);
                break;
            }
                          
            case 15:    //¸ðÀÚ,Åõ±¸
            case 19:    //¸ñ°ÉÀÌ
            case 20:
            case 21:  
            case 22:    //¹ÝÁö
            case 23:  
            case 24:    //ÆÈÂî
            case 26:  
            {
                bUseAble = false;
                
                // Ã¹Â°ÁÙ.
                /*if ( m_stItemInfo.S.Name[20] )
                    g_xMainWnd.StringPlus(Name, &m_stItemInfo.S.Name[20], " ", &m_stItemInfo.S.Name[0], "");
                else
                    strcpy(Name, m_stItemInfo.S.Name);*/
                iname = m_stItemInfo.S.Name.idup;
                iname = iname.stripRight;
                MyPen.drawText(nX, nY, name_color, iname);
                pt = MyPen.measureText(iname);
                
                lines[0] = format(" Weight.%s Dura.%s/%s", m_stItemInfo.S.Weight, m_stItemInfo.Dura/1000, m_stItemInfo.DuraMax/1000);
                MyPen.drawText(nX + pt.getX(), nY, maindesc_color, lines[0]);
                
                // µÎ¹øÂ°ÁÙ.
                // ¸ñ°ÉÀÌ.
                if ( m_stItemInfo.S.StdMode == 19 || m_stItemInfo.S.StdMode == 20 )
                {
                    if ( m_stItemInfo.S.AC > 0 )
                        lines[1] = lines[1] ~ format("¸¶¹ýÈ¸ÇÇ+%s ", HiByte(m_stItemInfo.S.AC));
                    
                    if ( LoByte(m_stItemInfo.S.MAC) > 0 )
                        lines[1] = lines[1] ~ format("Curse+%s ", LoByte(m_stItemInfo.S.MAC));
                    
                    if ( HiByte(m_stItemInfo.S.MAC) > 0 )
                        lines[1] = lines[1] ~ format("Luck+%s ", HiByte(m_stItemInfo.S.MAC));      
                }               
                // ¹ÝÁö.
                else if ( m_stItemInfo.S.StdMode == 22 || m_stItemInfo.S.StdMode == 23 )
                {
                    if ( HiByte(m_stItemInfo.S.MAC) > 0 )
                        lines[1] = lines[1] ~ format("Áßµ¶È¸º¹+%s ", HiByte(m_stItemInfo.S.MAC));
                    
                    if ( LoByte(m_stItemInfo.S.AC) > 0 )
                        lines[1] = lines[1] ~ format("A.Speed+%s ", LoByte(m_stItemInfo.S.AC));
                    
                    if ( LoByte(m_stItemInfo.S.MAC) > 0 )
                        lines[1] = lines[1] ~ format("A.Speed-%s ", LoByte(m_stItemInfo.S.MAC));
                }
                // ÆÈÂî.
                else if ( m_stItemInfo.S.StdMode == 24 || m_stItemInfo.S.StdMode == 26 )
                {
                    if ( m_stItemInfo.S.AC > 0 )
                        lines[1] = lines[1] ~ format("Accuracy+%s ", HiByte(m_stItemInfo.S.AC));
                    
                    if ( m_stItemInfo.S.MAC > 0 )
                        lines[1] = lines[1] ~ format("Agility+%s ", HiByte(m_stItemInfo.S.MAC));
                }
                else
                {
                    if ( m_stItemInfo.S.AC > 0 )
                        lines[1] = lines[1] ~ format("AC%s-%s ", LoByte(m_stItemInfo.S.AC), HiByte(m_stItemInfo.S.AC));
                    
                    if ( m_stItemInfo.S.MAC > 0 )
                        lines[1] = lines[1] ~ format("AMC%s-%s ", LoByte(m_stItemInfo.S.MAC), HiByte(m_stItemInfo.S.MAC));
                }
                
                if ( m_stItemInfo.S.DC > 0 )
                    lines[1] = lines[1] ~ format("DC%s-%s ", LoByte(m_stItemInfo.S.DC), HiByte(m_stItemInfo.S.DC));
                
                if ( m_stItemInfo.S.MC > 0 )
                    lines[1] = lines[1] ~ format("MC%s-%s ", LoByte(m_stItemInfo.S.MC), HiByte(m_stItemInfo.S.MC));
                
                if ( m_stItemInfo.S.SC > 0 )
                    lines[1] = lines[1] ~ format("SC%s-%s ", LoByte(m_stItemInfo.S.SC), HiByte(m_stItemInfo.S.SC));

                MyPen.drawText(nX, nY + nLineGap, maindesc_color, lines[1]);
                
                // ¼¼¹øÂ°ÁÙ.
                switch ( m_stItemInfo.S.Need )
                {
                    case 0:
                    {
                        if ( PlayScene.m_xMyHero.m_stAbility.Level >= m_stItemInfo.S.NeedLevel )
                            bUseAble = true;
                        lines[2] = format("Necessary level %s ", m_stItemInfo.S.NeedLevel);
                        break;
                    }
                    case 1:
                    {
                        if ( HiByte(PlayScene.m_xMyHero.m_stAbility.DC) >= m_stItemInfo.S.NeedLevel )
                            bUseAble = true;
                        lines[2] = format("Necessay DC %s ", m_stItemInfo.S.NeedLevel);
                        break;
                    }
                    case 2:
                    {
                        if ( HiByte(PlayScene.m_xMyHero.m_stAbility.MC) >= m_stItemInfo.S.NeedLevel )
                            bUseAble = true;
                        lines[2] = format("Necessary MC %s ", m_stItemInfo.S.NeedLevel);
                        break;
                    }
                    case 3:
                    {
                        if ( HiByte(PlayScene.m_xMyHero.m_stAbility.SC) >= m_stItemInfo.S.NeedLevel )
                            bUseAble = true;
                        lines[2] = format("Necessary SC %s ", m_stItemInfo.S.NeedLevel);
                        break;
                    }
                    default: break;
                }

                if ( bUseAble )
                    MyPen.drawText(nX, nY + nLineGap*2, maindesc_color, lines[2]);
                else
                    MyPen.drawText(nX, nY + nLineGap*2, disable_color, lines[2]);
                break;
            }
                
                /*      case 25:    //»Ñ¸®´Â µ¶°¡·ç
    case 30:    //ÃÊ,È½ºÒ
    case 40:    //°í±âµ¢¾î¸®
    case 42:
    case 43:
*/      default:
            {
                bUseAble = false;
                
                // Ã¹¹øÂ°ÁÙ.
                iname = m_stItemInfo.S.Name.idup;
                iname = iname.stripRight;
                MyPen.drawText(nX, nY, name_color, iname);
                pt = MyPen.measureText(iname);
                
                switch ( m_stItemInfo.S.StdMode )
                {
                    case 0:         // ¹°¾à.
                    {
                        if ( m_stItemInfo.S.AC > 0 )
                            lines[0] = lines[0] ~ format(" +%sHP ", m_stItemInfo.S.AC);
                        
                        if ( m_stItemInfo.S.MAC > 0 )
                            lines[0] = lines[0] ~ format(" +%sMP ", m_stItemInfo.S.MAC);
                        
                        lines[0] = lines[0] ~ format(" Weight.%s ", m_stItemInfo.S.Weight);

                        MyPen.drawText(nX + pt.getX(), nY, maindesc_color, lines[0]);
                        
                        break;
                    }
                    case 1:         // ¸»¸°°í±â.
                    case 2:         // ÁÖ¸Ô¹ä.
                        break;
                    case 3:         // Æ¯¼öÇÑ¹°¾à OR °¢Á¾Àü¼­µé.
                    {
                        lines[0] = format("Weight.%s", m_stItemInfo.S.Weight);
                        MyPen.drawText(nX + pt.getX(), nY, maindesc_color, lines[0]);
                        break;
                    }
                    case 4:         // °¢Á¾Ã¥µé.
                    {
                        lines[0] = format("Weight.%s", m_stItemInfo.S.Weight);
                        MyPen.drawText(nX + pt.getX(), nY, maindesc_color, lines[0]);
                        
                        switch ( m_stItemInfo.S.Shape )
                        {
                            case 0:
                            {
                                // µÑÂ°ÁÙ.
                                lines[1] = "Secret martial art skill of Warrior";
                                MyPen.drawText(nX, nY + nLineGap, maindesc_color, lines[1]);
                                
                                if ( (PlayScene.m_xMyHero.m_bJob == _JOB_WAR) && (PlayScene.m_xMyHero.m_stAbility.Level >= m_stItemInfo.S.DuraMax) )
                                    bUseAble = true;
                                break;
                            }
                            case 1:
                            {
                                // µÑÂ°ÁÙ.
                                lines[1] = "Spellbook of wizard";
                                MyPen.drawText(nX, nY + nLineGap, maindesc_color, lines[1]);
                               
                                if ( (PlayScene.m_xMyHero.m_bJob == _JOB_WIZ) && (PlayScene.m_xMyHero.m_stAbility.Level >= m_stItemInfo.S.DuraMax) )
                                    bUseAble = true;
                                break;
                            }
                            case 2:
                            {
                                lines[1] = "Secret martial art skill of Taoist";
                                MyPen.drawText(nX, nY + nLineGap, maindesc_color, lines[1]);

                                if ( (PlayScene.m_xMyHero.m_bJob == _JOB_TAO) && (PlayScene.m_xMyHero.m_stAbility.Level >= m_stItemInfo.S.DuraMax) )
                                    bUseAble = true;
                                break;
                            }
                            default: break;
                        }

                        lines[2] = format("Necessary level %s", m_stItemInfo.S.DuraMax);

                        if ( bUseAble )
                            MyPen.drawText(nX, nY + nLineGap*2, maindesc_color, lines[2]);
                        else
                            MyPen.drawText(nX, nY + nLineGap*2, disable_color, lines[2]);
                        break;
                    }
                    case 25:            // °¢Á¾ µ¶°¡·ç.
                    {
                        // Ã¹¹øÂ°ÁÙ.
                        lines[1] = format("Weight.%s", m_stItemInfo.S.Weight);
                        MyPen.drawText(nX, nY + nLineGap, maindesc_color, lines[1]);
                        
                        // µÎ¹øÂ°ÁÙ.
                        lines[2] = format("Count %s/%s", m_stItemInfo.Dura, m_stItemInfo.DuraMax);
                        MyPen.drawText(nX, nY + nLineGap*2, maindesc_color, lines[2]);
                        break;
                    }
                    case 30:            // È¶ºÒ°ú ÃÊ.
                    {
                        // µÎ¹øÂ°ÁÙ.
                        lines[1] = format("Weight.%s Usage.%s/%s", m_stItemInfo.S.Weight, m_stItemInfo.Dura/1000, m_stItemInfo.DuraMax/1000);
                        MyPen.drawText(nX, nY + nLineGap, maindesc_color, lines[1]);
                        break;
                    }
                    case 31:            // °¢Á¾¹­À½½Ã¸®Áî.
                    {
                        // Ã¹¹øÂ°ÁÙ.
                        lines[1] = format("Weight.%s", m_stItemInfo.S.Weight);
                        MyPen.drawText(nX, nY + nLineGap, maindesc_color, lines[1]);
                        break;
                    }
                    case 40:        // °¢Á¾°í±âµé(°í±âµ¢¾î¸®)
                    {
                        // µÎ¹øÂ°ÁÙ.
                        lines[1] = format("Weight.%s Quality.%s/%s", m_stItemInfo.S.Weight, m_stItemInfo.Dura/1000, m_stItemInfo.DuraMax/1000);
                        MyPen.drawText(nX, nY + nLineGap, maindesc_color, lines[1]);
                        break;
                    }
                    case 42:            // °¢Á¾¾àÀçµé.
                    {
                        // µÎ¹øÂ°ÁÙ.
                        lines[1] = format("Weight.%s PoisonIngredient", m_stItemInfo.S.Weight);
                        MyPen.drawText(nX, nY + nLineGap, maindesc_color, lines[1]);
                        break;
                    }
                    case 43:        // °¢Á¾±¤¼®µé.
                    {
                        // µÎ¹øÂ°ÁÙ.
                        lines[1] = format("Weight.%s Purity.%s", m_stItemInfo.S.Weight, m_stItemInfo.Dura/1000);
                        MyPen.drawText(nX, nY + nLineGap, maindesc_color, lines[1]);
                        break;
                    }
                    case 44:        // »óÁ¡¿¡´Â ¾ø´Â Æ¯¼ö ¾ÆÀÌÅÛ.
                        break;
                    case 45:        // ¶¥¿¡ ¶³¾îÁú¶§ ¹Ù²î´Â ±â´É¼º ¾ÆÀÌÅÛ.
                        break;
                    case 46:        // ±â´ÉÀº ¾ø´Â ´Ü¼ø¾ÆÀÌÅÛ.
                    default:
                    {
                        // µÎ¹øÂ°ÁÙ.
                        lines[1] = format("Weight.%s", m_stItemInfo.S.Weight);
                        MyPen.drawText(nX, nY + nLineGap, maindesc_color, lines[1]);
                        break;
                    }
                }
            }
            break;
        }
    }

}